<template>
	<view>
		<!-- <u-index-list :scrollTop="scrollTop">
			<view v-for="(item, index) in indexList" :key="index">
				<u-index-anchor :index="item">
					<text class="anchor-text">{{item}}</text>
				</u-index-anchor>
				<block v-for="(v,vi) in indexListData[item]" :key="vi">
					<view class="list-cell u-border-bottom" @tap="toSeries(v)">
						<u-image width="80rpx" height="80rpx" :src="v.logo"></u-image>
						<text class="anchor-text">{{v.name}}</text>
					</view>
				</block>
			</view>
		</u-index-list> -->
		<uni-indexed-list :options="indexListData" :showSelect="false" @click="toSeries"></uni-indexed-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				scrollTop: 0,
				indexList: [],
				indexListData: []
			}
		},
		
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},

		onLoad() {
			let that = this
			
			uni.showLoading({
				title: "加载中..."
			})
			uni.request({
				url: getApp().globalData.serviceUrl + "/chexk/kuybChexk/getBrandList",
				data: {},
				header: {},
				method: 'GET',
				success: (resp) => {
					uni.hideLoading()
					if (resp.data.success) {
						that.indexListData = resp.data.result
						
						// for (var key in resp.data.result) {
						// 	that.indexList.push(key)
						// }
					}
				}
			});
		},

		methods: {
			toSeries(b) {
				uni.setStorage({
					key:'brandInfo',
					data:b.item,
					success() {
						uni.redirectTo({
							url:"../../pages2/seriesList/seriesList"
						})
					}
				})
			}
		}
	}
</script>

<style>
	.list-cell {
		display: flex;
		box-sizing: border-box;
		width: 100%;
		padding: 10px 24rpx;
		overflow: hidden;
		color: #323233;
		font-size: 14px;
		line-height: 24px;
		background-color: #fff;
	}

	.anchor-text {
		margin-left: 20rpx;
		margin-top: 10rpx;
	}
</style>
